package com.achievo.know.domain;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;

import com.achievo.know.vo.TestVO;
import com.dayatang.domain.BaseEntity;
import com.dayatang.domain.InstanceFactory;

@Entity
@Table(name="ddd_test")
public class TestEntity extends BaseEntity{
	
	

	/**
	 * 
	 */
	private static final long serialVersionUID = -8766677199803415412L;
	@Column(name="t_name",length=100)
	private String name;
	
	
	public TestEntity() {
	}
	
	public TestEntity(TestVO vo) {
		setName(vo.getName());
	}

	private static TestRespository respository;
	
	public static TestRespository getRespository(){
		if(respository==null){
			respository=InstanceFactory.getInstance(TestRespository.class);
		}
		return respository;
	}
	
	public void save(){
		getRespository().save(this);
	}
	
	public void update(TestVO vo){
		setName(vo.getName());
		getRespository().save(this);
	}
	
	public void remove(){
		getRespository().remove(this);
	}

	public static TestEntity get(Long id) {
		return getRespository().get(id);
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@Override
	public boolean equals(Object arg0) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public int hashCode() {
		// TODO Auto-generated method stub
		return 0;
	}

}
